﻿
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using FarmSmartSleep.Common.Domain.RBACFile;
using System.Runtime.InteropServices;
using System;
using SheepCultivation.Common.Dto;
using SheepCultivation.API.AddliCation.Tip_newspaper;
using SheepCultivation.API.AddliCation.RBAC;
using SheepCultivation.Enum;
namespace R.FarmSmartSleep.RBAC.API.Controllers
{
    /// <summary>
    /// RBAC权限管理
    /// </summary>s
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RBACsController : ControllerBase
    {
        private readonly IMediator mediator;
        private readonly ILogger<RBACsController> _logger;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="_mediator"></param>
        public RBACsController(IMediator _mediator, ILogger<RBACsController> logger)
        {
            mediator = _mediator;
            _logger = logger;
        }

        /// <summary>
        /// 员工添加
        /// </summary>
        /// <param name="enm"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> Handle(EmployeeCreateCommon enm)
        {
            var list = await mediator.Send(enm);
            return list;
        }
        /// <summary>
        /// 员工列表
        /// </summary>
        /// <param name="enm"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> Handle1(EmployeeListCommon enm)
        {
            return await mediator.Send(enm);

        }

        [HttpPost("Login")]
        public async Task<Result> Handle(UserSeachCommon request)
        {
            return await mediator.Send(request);
        }
    }
}
